#include <bits/stdc++.h>
using namespace std;
bool solve() {
  string s;
  cin >> s;
  int nLeft = 0, nRight = 0;
  for (auto ch : s) {
    if (ch == '(') nLeft++;
    if (ch == ')') nRight++;
  }
  int nLeftNeed = s.size() / 2 - nLeft;
  int nRightNeed = s.size() / 2 - nRight;
  if (!nLeftNeed || !nRightNeed) return true;

  int lastLeft = -1;
  int firstRight = -1;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '?') {
      nLeftNeed--;
      s[i] = '(';
      lastLeft = i;
      if (nLeftNeed == 0) break;
    }
  }
  for (int j = lastLeft + 1; j < s.size(); ++j) {
    if (s[j] == '?') {
      nRightNeed--;
      s[j] = ')';
      if (firstRight == -1) firstRight = j;
      if (nRightNeed == 0) break;
    }
  }
  s[lastLeft] = ')';
  s[firstRight] = '(';

  int cnt = 0;
  for (char i : s) {
    if (i == '(')
      cnt++;
    else
      cnt--;
    if (cnt < 0) return true;
  }
  return cnt != 0;
}
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    cout << (solve() ? "YES\n" : "NO\n");
  }
}
